package com.smbms.conver;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.core.convert.converter.Converter;


public class DateFormatConver implements Converter<String, Date> {

	
	private String pattern;//转换格式
	
	public Date convert(String arg0) {
		
		try {
			SimpleDateFormat sdf = new SimpleDateFormat(pattern);
			Date date = sdf.parse(arg0.toString());
			return date;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	public String getPattern() {
		return pattern;
	}

	public void setPattern(String pattern) {
		this.pattern = pattern;
	}

	
	
}
